<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>

<div th:fragment="nav">
    <nav class="navbar navbar-default index-navigation">
        <div class="row">
            <!--导航条左空白-->
            <div class="col-md-1 col-xs-1 col-sm-1 col-lg-1"></div>
            <!--导航条内容-->
            <div class="container-fluid col-md-10 col-xs-10 col-sm-10 col-lg-10">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">CodePlayerBlog</span>
                    </button>
                    <a class="navbar-brand" th:href="@{/index}">CodePlayerBlog</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <form class="navbar-form navbar-left" action="/search">
                        <div class="form-group">
                            <input type="text" class="form-control" name="content" autocomplete="off" placeholder="搜索问题 ">
                        </div>
                        <button type="submit" class="btn btn-default" th:href="@{/search}">搜索</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="btn-group index-write">
                            <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"
                                    aria-haspopup="true" aria-expanded="false">
                                撰写 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a th:href="@{/particle}">写文章</a></li>
                                <li><a href="#">记笔记</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a th:href="@{/profile/draft}">草搞箱</a></li>
                            </ul>
                        </li>
                        <li><a th:href="@{/profile/replies}">通知<span class="badge index-messages" th:text="${session.unreadCount}"></span></a></li>
                        <li class="dropdown" th:if="${session.user != null}">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                               aria-expanded="false" th:text="${session.user.getName()}">
                                <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a th:href="@{/profile/article}">我的文章</a></li>
                                <li><a href="#">个人资料</a></li>
                                <li><a th:href="@{/logout}">登出</a></li>
                            </ul>
                        </li>
                        <li><a th:href="@{/login}" th:if="${session.user == null}">登录</a></li>
                        <li>
                            <a th:href="${'https://github.com/login/oauth/authorize?client_id='+@environment.getProperty('github.client.id')+'&redirect_uri='+@environment.getProperty('github.redirect.url')+'&scope=user&state=1'}"
                               title="GITHUB登入"><img src="/image/loginImgs/github120c.png" style="height: 26px"></a></li>
                    </ul>
                </div>
            </div>
            <!--导航条右空白-->
            <div class="col-md-1 col-xs-1 col-sm-1 col-lg-1"></div>
        </div>
    </nav>
</div>

</body>
</html>